import { post, postWithLoadTip } from '@/utils/request';

export function edit(data: any): any {
  if (data.id === null) {
    return postWithLoadTip(`/pxksgl-api/department/create`, data);
  } else {
    return postWithLoadTip(`/pxksgl-api/department/update`, data);
  }
}

export function move(data: any): any {
  return postWithLoadTip(`/pxksgl-api/department/move`, data);
}

export function tree(): any {
  return post(`/pxksgl-api/department/tree`, undefined);
}

export function allTree(): any {
  return post(`/pxksgl-api/department/treeALL`, undefined);
}

// export function allTree(): any {
//   return post(`/pxksgl-api/department/all/tree`, undefined);
// }

export function deleteDepartment(id): any {
  return postWithLoadTip(`/pxksgl-api/department/delete/${id}`, undefined);
}
